package chpt08;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileCopyByByte {

	public static void main(String[] args) throws IOException{
		FileInputStream in = null;
		FileOutputStream out = null;
		try {
			in = new FileInputStream("test.txt");
			out = new FileOutputStream("test.bak");
			int c;
			while((c=in.read())!=-1)
				out.write(c);
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			if (in!=null)
				in.close();
			if (out!=null)
				out.close();
		}
	}
}
